import request from './wrapRequest';

/**
 * 用户列表
 * @param data 
 * @returns 
 */
import { ProductProps } from '@/types/productTypes';


/**
 * 暂时不做分页
 * @returns 
 */
export const fetchList = () => {
  return  request.get<ProductProps[]>(`/admin/user/product/list`);
}

/**
 * 增加用户
 * @param data 
 * @returns 
 */
export const addProduct = (data: ProductProps) => {
  return  request.put<boolean>(`/admin/user/product/create`, data);
}


/**
 * 更新用户
 * @param data 
 * @returns 
 */
export const updateProduct = (data: ProductProps) => {
  return  request.post<boolean>(`/admin/user/product/update`, data);
}

/**
 * 删除用户
 * @param data 
 * @returns 
 */
export const deleteProduct = (data: ProductProps) => {
  return  request.delete<boolean>(`/admin/user/product/delete/`+ data._id);
}